package com.example.emos.wx.controller;

import com.example.emos.wx.common.util.R;
import com.example.emos.wx.config.xss.XssHttpServletRequestWrapper;
import com.example.emos.wx.controller.form.TestSayHelloForm;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.http.HttpRequest;
import org.springframework.http.server.ServletServerHttpRequest;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;

@RestController
@RequestMapping("/test")
@Api("测试WEB接口")
public class TestController {

    @PostMapping("/satHello")
    @ApiOperation("最简单的测试方法")
    public R sayHello(@Valid @RequestBody TestSayHelloForm form){


        return R.ok().put("message","Hello  " + form.getName());
    }

    @PostMapping("addUser")
    @ApiOperation("添加用户")
    @RequiresPermissions(value = {"A","B"}, logical = Logical.OR)
    public R addUser(){
        return R.ok("添加用户成功");
    }


}
